function s1_goto_dir(){
file_to_create="$1"
if [ -z "$file_to_create" ]; then
echo "Usage: $0 filename"
exit 1
fi
cd $1
}
function s2_touch_empty_file_with_given_name(){
if ! touch "$file_to_create"; then
echo "Error creating file: $file_to_create"
exit 1
else
echo "File created successfully: $file_to_create"
fi
touch --"$1"
}
function s3_make_directories(){
mkdir -p projects/git projects/backup
}
function s4_create_6_files(){
touch projects/linux1_centos projects/linux1_redhat projects/linux1_c_programming projects/linux2_centos projects/linux2_redhat projects/linux2_c_programming
}
function s5_make_directories_in_git(){
mkdir -p projects/git/linux1 projects/git/linux2
}
function s6_move_files_to_dir_1_or_2(){
mv projects/linux1_* projects/git/linux1/
mv projects/linux2_* projects/git/linux2/
}
function s7_create_package_and_compress(){
tar -czvf projects/backup/git.tar.gz -c projects git
}
function s8_delete_dir_git(){
rm -r projects/git
}
function s9_recover_from_git_tar_gz_backup(){
tar -zxvf projects/backup/git.tar.gz -C projects
}
function s10_create_package_and_compress(){
tar -jcvf projects/backup/git.tar.bz2 -C projects git
}
function s11_find_and_sort_alphabetically_all_created_files_and_dirs(){
find . -type f ,d -printf "%p\n" | sort
find projects -type f -printf"%T@ %p" |sort -n | cut -d' ' -f2-
}
function s12_get_nect_15_minutes_boundary(){
current_min=$(data +%M)
min_to_next_quarter=$(( (15 - current_min %15) % 15 ))
if [ $current_min -eq 0 ] || [ $((current_min % 15)) -eq 0 ];then
min_to_next_quarter=$(( (15 - current_min % 15) % 15))
if [ $current_min -eq 0 ] || [ $((current_min % 15)) -eq 0 ];then
min_to_next_quarter=0
next_quarter_time=$(data -d "+$min_to_next_quarter minutes" +"%Y-%m-%d %H:%M")
echo "Then next 15-minute boundary is at: $next_quarter_time"
data -d "$(($(data +%s) / 900 + 1)) * 900" "+%Y-%m-%d_%H:%M:%S"
fi
fi
}
